package com.andy;

import com.andy.rpc.ConsumerClient;
import com.andy.server.UserService;

import java.util.Random;

public class ConsumerBoot {
    public static void main(String[] args){
        //1-获取代理对象
        UserService userService = (UserService) ConsumerClient.createProxy(UserService.class);
        Random random = new Random();

        try {
            while(true){
                String name = "Andy"+random.nextInt(100);
                System.out.println("发起RPC调用，入参name====>>>> "+name);
                String result = userService.hello(name);
                System.out.println("拿到RPC返回的结果，出参====>>>> "+result);

                Thread.sleep(2000);
                System.out.println();
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    
}
